package run.halo.app.event;

import java.nio.file.Path;
import java.util.EventObject;

import lombok.Getter;
import org.springframework.context.ApplicationEvent;

/**
 * @author ryanwang
 * @date 2020-03-24
 */
// TODO LYF 自定义事件继承自spring的ApplicationEvent
/*
TODO LYF Spring事件处理一般过程：

◆定义Event类，继承org.springframework.context.ApplicationEvent。
◆编写发布事件类Publisher，实现org.springframework.context.ApplicationContextAware接口。
◆覆盖方法setApplicationContext(ApplicationContext applicationContext)和发布方法publish(Object obj)。
◆定义时间监听类EventListener，实现ApplicationListener接口，实现方法onApplicationEvent(ApplicationEvent event)。
参考
   https://www.cnblogs.com/xingzc/p/5830279.html
   https://www.cnblogs.com/xingzc/p/5830279.html
 */
public class StaticStorageChangedEvent extends ApplicationEvent {

    @Getter
    private final Path staticPath;

    /**
     * Create a new {@code ApplicationEvent}.
     *
     * @param source the object on which the event initially occurred or with
     * which the event is associated (never {@code null})
     */
    public StaticStorageChangedEvent(Object source, Path staticPath) {
        super(source);
        this.staticPath = staticPath;
    }
}
